//package com.jackrain.nea.clould.config;
//
///**
// * Created by jackrain on 16/8/2.
// */
//
//import com.alibaba.dubbo.config.*;
//import com.alibaba.dubbo.config.spring.AnnotationBean;
//import com.jackrain.nea.config.PropertiesConf;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.AutoConfigureOrder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.PropertySource;
//
///**
// * @author jackrain
// */
//@Slf4j
//@AutoConfigureOrder(4)
//@Configuration
//public class DubboConfig {
//
//    public static final String APPLICATION_NAME = "com.jackrain.nea-Privod";
//
//    @Autowired
//    private PropertiesConf pconf;
//
//    public static final String ANNOTATION_PACKAGE = "com.jackrain.nea";
//
//    @Bean
//    public ApplicationConfig applicationConfig() {
//        ApplicationConfig applicationConfig = new ApplicationConfig();
//        applicationConfig.setName(APPLICATION_NAME);
//        applicationConfig.setLogger("slf4j");
//        return applicationConfig;
//    }
//
//    @Bean
//    public RegistryConfig registryConfig() {
////        RegistryConfig registryConfig = new RegistryConfig();
////        registryConfig.setAddress(REGISTRY_ADDRESS);
//
//        String REGISTRY_ADDRESS=pconf.getProperty("zookeeper.server");
//        RegistryConfig registryConfig = new RegistryConfig();
//        registryConfig.setAddress(REGISTRY_ADDRESS);
//
//        return registryConfig;
//    }
//
////    @Bean
////    public RegistryConfig registryConfig() {
////        pconf= ApplicationContextHandle.getBean("propertiesConf");
////        String REGISTRY_ADDRESS=pconf.getProperty("zookeeper.server");
////        RegistryConfig registryConfig = new RegistryConfig();
////        log.debug("dubbo privode addr->"+REGISTRY_ADDRESS);
////        registryConfig.setAddress(REGISTRY_ADDRESS);
////        return registryConfig;
////    }
//
//    @Bean
//    public static AnnotationBean annotationBean() {
//        AnnotationBean annotationBean = new AnnotationBean();
//        annotationBean.setPackage(ANNOTATION_PACKAGE);
//        return annotationBean;
//    }
//
//    @Bean
//    public ConsumerConfig consumerConfig() {
//        ConsumerConfig consumerConfig = new ConsumerConfig();
//        consumerConfig.setTimeout(60000);
//        return consumerConfig;
//    }
//
//    @Bean
//    public ProviderConfig providerConfig() {
//        ProviderConfig providerConfig = new ProviderConfig();
//        providerConfig.setTimeout(60000);
//        return providerConfig;
//    }
//
//    @Bean(name = "dubbo")
//    public ProtocolConfig protocolConfig() {
//        ProtocolConfig protocolConfig = new ProtocolConfig();
//        String dubboport=pconf.getProperty("dubbo.port");
//        protocolConfig.setPort(Integer.valueOf(dubboport));
//     //   protocolConfig.setSerialization("dubbo");
//     //   protocolConfig.setHost("jstunkhdevgnuc");
////        protocolConfig.setAccesslog("true");
//        return protocolConfig;
//    }
//
////    /**
////     * 注意：目前线程池的设置只有当server="netty"或者server="jetty"或者server="tomcat"的时候才能生效。另外，如果server="servlet"，由于这时候启用的是外部应用服务器做rest server，不受dubbo控制，所以这里的线程池设置也无效。
////     * @return
////     */
////    @Bean(name = "rest")
////    public ProtocolConfig protocolConfigrest() {
////        ProtocolConfig protocolConfig = new ProtocolConfig();
////        protocolConfig.setServer("servlet");
////        protocolConfig.setContextpath("rest");
////        protocolConfig.setName("rest");
////        protocolConfig.setExtension("com.jackrain.nea.exception.CustomExceptionMapper");
////        protocolConfig.setPort(8080);
////        protocolConfig.setThreads(500);
////        return protocolConfig;
////    }
//
//    /**
//     * 增加monitor 的回调统计
//     * @return
//     */
//    @Bean
//    public MonitorConfig monitorConfig() {
//        MonitorConfig monitorConfig = new MonitorConfig();
//        String monitor_addr=pconf.getProperty("dubbo.monitor");
//        log.debug("dubbo privode monitor_addr->"+monitor_addr);
//        monitorConfig.setAddress(monitor_addr);
//        return monitorConfig;
//    }
//
////    @Bean
////    public ServletRegistrationBean servletRegistrationBean() {
////        return new ServletRegistrationBean(new com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet(), "/rest/*");// ServletName默认值为首字母小写，即myServlet
////    }
////
////
////    @Bean
////    public ServletListenerRegistrationBean<ServletContextListener> stormpathServletContextListener() {
////        ServletContextListener listener = new BootstrapListener();
////        return new ServletListenerRegistrationBean<ServletContextListener>(listener);
////    }
//
//
//
//
//}
